package com.ocom.common.resp;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.ocom.common.enums.MachEnum;

import java.io.Serializable;



//门禁机器响应类
@JsonIgnoreProperties(value = {"hibernateLazyInitializer"})

public class RespMachMessage<T> implements Serializable {
    private static final Long serialVersionUID = -275582243440137389L;

    private String code;
    private String msg;

    @JsonIgnoreProperties(value = {"data", "data"})
    private T data;

    public RespMachMessage() {

    }

    public RespMachMessage(MachEnum machEnum) {
        this.code = machEnum.getKey();
        this.msg = machEnum.getValue();
    }

    public RespMachMessage(MachEnum machEnum, T data) {
        this.code = machEnum.getKey();
        this.msg = machEnum.getValue();
        this.data = data;
    }

    /**
     * 返回 code和data数据
     */
    public RespMachMessage(String code, T data) {
        this.code = code;
        this.data = data;
    }

    public RespMachMessage(String result, String msg, T data) {
        this.code = result;
        this.msg = msg;
        this.data = data;
    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "RespMachMessage{" +
                "code='" + code + '\'' +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}
